import Vue from 'vue'
import VueRouter from 'vue-router'
import orderAll from '@/views/order/orderAll'
import orderTo from '@/views/order/orderTo'
import orderComplete from '@/views/order/orderComplete'
import orderAwait from '@/views/order/orderAwait'
import orderEvaluate from '@/views/order/orderEvaluate'
import Footer from '@/components/Footer.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    components: {
      default: () => import('@/views/home/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/kind',
    name: 'kind',
    components: {
      default: () => import('@/views/kind/index.vue')
    }
  },
  {
    path: '/notice',
    name: 'notice',
    components: {
      default: () => import('@/views/notice/index.vue')
    }
  },
  {
    path: '/huiyuan',
    name: 'huiyuan',
    components: {
      default: () => import('@/views/huiyuan/index.vue')
    }
  },
  {
    path: '/kefu',
    name: 'kefu',
    components: {
      default: () => import('@/views/kefu/index.vue')
    }
  },
  {
    path: '/proall',
    name: 'proall',
    components: {
      default: () => import('@/views/proall/index.vue')
    }
  },
  {
    path: '/cuxiao',
    name: 'cuxiao',
    components: {
      default: () => import('@/views/cuxiao/index.vue')
    }
  },
  {
    path: '/user',
    name: 'user',
    components: {
      default: () => import('@/views/users/index.vue')
    }
  },
  {
    path: '/address',
    name: 'address',
    components: {
      default: () => import('@/views/address/index.vue')
    }
  },
  {
    path: '/addAdd',
    name: 'addAdd',
    components: {
      default: () => import('@/views/address/add.vue')
    }
  },
  {
    path: '/register2',
    name: 'register2',
    components: {
      default: () => import('@/views/register2/index.vue')
    }
  },
  {
    path: '/register-ing',
    name: 'register-ing',
    components: {
      default: () => import('@/views/register2/register-ing.vue')
    }
  },
  {
    path: '/login',
    name: 'login',
    components: {
      default: () => import('@/views/login/index.vue')
    }
  },
  {
    path: '/order',
    name: 'order',
    components: {
      default: () => import('@/views/order/index.vue')
    },
    children: [
      { path: '/order/all', component: orderAll },
      { path: '/order/to', component: orderTo },
      { path: '/order/complete', component: orderComplete },
      { path: '/order/await', component: orderAwait },
      { path: '/order/evaluate', component: orderEvaluate }
    ]
  },
  {
    path: '/resetPassword',
    name: 'resetPassword',
    components: {
      default: () => import('@/views/login/resetPassword.vue')
    }
  },
  {
    path: '/resetPasswordTo',
    name: 'resetPasswordTo',
    components: {
      default: () => import('@/views/login/resetPasswordTo.vue')
    }
  },
  {
    path: '/detail',
    name: 'detail',
    components: {
      default: () => import('@/views/detail/index.vue')
    }
  },
  {
    path: '/echarts',
    name: 'echarts',
    components: {
      default: () => import('@/components/Echarts.vue')
    }
  },
  {
    path: '/feedback',
    name: 'feedback',
    components: {
      default: () => import('@/components/Feedback.vue')
    }
  },
  {
    path: '/cart',
    name: 'cart',
    components: {
      default: () => import('@/views/cart/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/wallet',
    name: 'wallet',
    components: {
      default: () => import('@/views/wallet/index.vue')
    }
  },
  {
    path: '/collection',
    name: 'collection',
    components: {
      default: () => import('@/views/collection/index.vue')
    }
  },
  {
    path: '/user/shezhi',
    name: 'shezhi',
    components: {
      default: () => import('@/views/users/shezhi.vue')
    }
  },
  {
    path: '/guanyu',
    name: 'guanyu',
    components: {
      default: () => import('@/components/Guanyu.vue')
    }
  },
  {
    path: '/search',
    name: 'search',
    components: {
      default: () => import('@/views/search/index.vue')
    }
  },
  {
    path: '/pay',
    name: 'pay',
    components: {
      default: () => import('@/components/Pay.vue')
    }
  }
]

const router = new VueRouter({
  // mode: 'history',
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
